//
//  ZH_MineInfoPhotoTableViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/22.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_MineInfoPhotoTableViewCell.h"
@interface ZH_MineInfoPhotoTableViewCell()
@property (nonatomic,weak)UIImageView *photoImage;
@property (nonatomic,weak)UIButton *photoButton;
@end
@implementation ZH_MineInfoPhotoTableViewCell

///创建
+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_MineInfoPhotoTableViewCell";
    ZH_MineInfoPhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_MineInfoPhotoTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
///初始化
-(void)initDefault
{
    [self unShowClickEffect];
    //    self.bottomShortLineImage.hidden = NO;
}
- (void)loadSubviewConstraints{
    [self.photoImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(20));
        make.centerX.equalTo(self.contentView);
        make.width.mas_equalTo(FITSCALE(65));
        make.height.mas_equalTo(FITSCALE(65));
    }];
    [self.photoButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.photoImage.mas_bottom).offset(FITSCALE(9));
        make.centerX.equalTo(self.contentView);
        make.width.mas_equalTo(FITSCALE(69));
        make.height.mas_equalTo(FITSCALE(23));
        make.bottom.equalTo(self.contentView).offset(FITSCALE(-20));
    }];
}
#pragma mark - getter,setter
- (UIImageView *)photoImage{
    if (!_photoImage) {
        UIImageView *image = [UIImageView createImageViewWithName:@""];
        image.backgroundColor = kFontColorRed;
        image.layer.cornerRadius = FITSCALE(65/2);
        image.layer.masksToBounds = YES;
        image.clipsToBounds = YES;
        [self.contentView addSubview:_photoImage = image];
    }
    return _photoImage;
}
- (UIButton *)photoButton{
    if (!_photoButton) {
        UIButton *button = [UIButton createNoBgButtonWithTitle:@"修改头像" target:self action:nil];
        [button setTitleColor:[UIColor colorWithHexString:@"#00C9AE"] forState:UIControlStateNormal];
        button.layer.cornerRadius = FITSCALE(11);
        button.layer.borderWidth = FITSCALE(1);
        button.layer.borderColor = [UIColor colorWithHexString:@"#00C9AE"].CGColor;
        button.layer.masksToBounds = YES;
        button.clipsToBounds = YES;
        [self.contentView addSubview:_photoButton = button];
    }
    return _photoButton;
}
@end
